#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
// 使用一个哈希表来存储已经计算过的结果
unordered_map<string, ll> memo;

ll w(ll a, ll b, ll c)
{
    // 生成唯一的键来标识当前参数组合
    string key = to_string(a) + "," + to_string(b) + "," + to_string(c);

    // 如果已经计算过，直接返回结果
    if (memo.find(key) != memo.end())
    {
        return memo[key];
    }

    if (a <= 0 || b <= 0 || c <= 0)
    {
        memo[key] = 1;
    }
    else if (a > 20 || b > 20 || c > 20)
    {
        memo[key] = w(20, 20, 20);
    }
    else if (a < b && b < c)
    {
        memo[key] = w(a, b, c - 1) + w(a, b - 1, c - 1) - w(a, b - 1, c);
    }
    else
    {
        memo[key] = w(a - 1, b, c) + w(a - 1, b - 1, c) + w(a - 1, b, c - 1) - w(a - 1, b - 1, c - 1);
    }

    return memo[key];
}

void solve()
{
    ll a, b, c;
    while(cin>> a >> b >>c )
    {
        if (a == b && b == c && c == -1)
        {
            return;
        }
        printf("w(%lld, %lld, %lld) = ", a, b, c);
        cout << w(a, b, c);
        cout << endl;
    }
}
int main()
{
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
